
//
//	File: OyMovementController.h
//

#ifndef OY_MOVEMENTCONTROLLER_H
#define OY_MOVEMENTCONTROLLER_H


/**
 * Base class for all types of controllers to inherit from. This already
 * implements a very basic camera that is unaware of its surrounding
 * but able to move totally free like in zero-g space. 
 */
class DllExport OyMovementController 
{
protected:
	struct DllExport GeneralLibVector 
	{ 
		float x, y, z, w; 
		GeneralLibVector() { w = 1; }
		void Set(float _x, float _y, float _z) { x=_x; y=_y; z=_z; w=1; }
	};
	struct DllExport GeneralLibQuat { float x, y, z, w; };

public:

	OyMovementController();
    virtual ~OyMovementController();

    virtual void Update(float fElapsedTime) = 0;

    // accessor methods(only x/y/z are valid)
    float* GetPos(void)       { return (float*)&m_vcPos;			}
    float* GetRight(void)     { return (float*)&m_vcRight;			}
    float* GetUp(void)        { return (float*)&m_vcUp;				}
    float* GetDir(void)       { return (float*)&m_vcDir;			}
    float* GetVelocity(void)  { return (float*)&m_vcVelocity;		}

protected:
    GeneralLibVector		m_vcPos;      // position
    GeneralLibVector		m_vcRight;    // right vector
    GeneralLibVector		m_vcUp;       // up vector
    GeneralLibVector		m_vcDir;      // direction vector (look direction)
    GeneralLibVector		m_vcVelocity; // velocity vector (movement direction)
    GeneralLibQuat			m_Quaternion; // quaternion for rotation

    // rotation speed around local vectors
    float					m_fRollSpeed;
    float					m_fPitchSpeed;
    float					m_fYawSpeed;

    float					m_fRollSpeedMax;
    float					m_fPitchSpeedMax;
    float					m_fYawSpeedMax;

    // rotation value around local vectors
    float					m_fRotX;
    float					m_fRotY;
    float					m_fRotZ;

    // other stuff
    float					m_fThrust;


    virtual void			RecalcAxes(void);
    virtual void			Init(void);
};

#endif